import request from '@/utils/request'

const workFlowPrefix = '/workflow'

const busiPrefix = '/WfBusiExt'

// 工作流我的待办
export function wfProcessToDoList(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/getToDoList?',
    method: 'POST',
    data: args
  })
}

// 工作流我的已办
export function wfProcessHasToDoList(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/getHasToDoList?',
    method: 'POST',
    data: args
  })
}

// 工作流代理待办
export function wfProcessAgentToDoList(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/getAgentToDoList?',
    method: 'POST',
    data: args
  })
}

// 工作流代理已办
export function wfProcessAgentHasToDoList(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/getAgentHasToDoList?',
    method: 'POST',
    data: args
  })
}

// 工作流待办所有
export function wfProcessToDoAll(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/getToDoListOfAllUser?',
    method: 'POST',
    data: args
  })
}

// 工作流已办所有
export function wfProcessHasToDoAll(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/getHasToDoListOfAllUser?',
    method: 'POST',
    data: args
  })
}

// 查询流程运行状态
export function wfProcessMonitor(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/getProcessMonitorByProcInst?procInstanceId=' + args.procInstanceId,
    method: 'POST',
    data: args
  })
}

// 查询流程审核历史
export function wfProcessAuditHistory(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/getAuditHistory?businessId=' + args.businessId + '&busiTypeId=' + args.busiTypeId,
    method: 'POST',
    data: args
  })
}

// 查询业务绑定流程列表
export function wfBusiProcessList(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/getProcListByBusiType?busiTypeId=' + args.busiTypeId + '&orgId=' + args.orgId + '&corpId=' + args.corpId,
    method: 'POST',
    data: args
  })
}

// 查询业务绑定流程环节列表
export function wfBusiProcActListForSubmit(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/getActListForSubmit',
    method: 'POST',
    data: args
  })
}

// 获取审核按钮列表
export function wfBusiProcActAuditBtn(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/getButtonForAudit?workitemInsId=' + args.workitemInsId,
    method: 'POST',
    data: args
  })
}

// 前加签
export function wfBusiProcAddSigner(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/doAddSigner',
    method: 'POST',
    data: args
  })
}

// 加签通过
export function wfBusiProcAddSignerPass(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/addSignerPass',
    method: 'POST',
    data: args
  })
}

// 加签驳回
export function wfBusiProcAddSignerReject(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/addSignerReject',
    method: 'POST',
    data: args
  })
}

// 审核时，获取下一环节列表
export function wfBusiProcActListForAudit(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/getActListForAudit',
    method: 'POST',
    data: args
  })
}

// 审核通过
export function wfBusiProcAuditPass(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/auditPass',
    method: 'POST',
    data: args
  })
}

// 选择节点驳回时，获取下一环节列表
export function wfBusiProcActListForReject(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/getActListForReject',
    method: 'POST',
    data: args
  })
}

// 选择节点驳回
export function wfBusiProcRejectBySendToFree(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/doRejectBySendToFree',
    method: 'POST',
    data: args
  })
}

// 整体驳回（流程终止）
export function wfBusiProcReject(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/doRejectByDefault',
    method: 'POST',
    data: args
  })
}

// 抢签
export function wfBusiProcRushToSign(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/rushToSign',
    method: 'POST',
    data: args
  })
}

// 单据撤回（申请人撤回）
export function wfBusiProcApplyWithdraw(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/applyWithdraw?procInstanceId=' + args.procInstanceId,
    method: 'POST',
    data: args
  })
}

// 审核人是否可撤回
export function wfBusiProcAuditWithdrawEnable(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/auditWithdrawEnable?userId=' + args.userId + '&workitemInsId=' + args.workitemInsId,
    method: 'POST',
    data: args
  })
}

// 审核人撤回
export function wfBusiProcAuditWithdraw(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/auditWithdraw?userId=' + args.userId + '&workitemInsId=' + args.workitemInsId,
    method: 'POST',
    data: args
  })
}

// 更新待办为已读
export function wfBusiProcViewToDo(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/viewToDo?userId' + args.userId + '&workitemInsId=' + args.workitemInsId,
    method: 'POST',
    data: args
  })
}

// 判断工作项是否未被审核完成
export function wfProcessIsExistToBeDone(args) {
  return request({
    url: workFlowPrefix + busiPrefix + '/isExistToBeDone?workitemInsId=' + args.workitemInsId,
    method: 'POST',
    data: args
  })
}

